﻿using System.Collections.Generic;

namespace Model
{
	public class CellDefinition
	{

		private Dictionary<string, Attribut> attributes = new Dictionary<string, Attribut>();

		public Dictionary<string, Attribut> Attributes
		{
			get { return attributes; }
			set { attributes = value; }
		}

		private string name;
		public string Name
		{
			get { return name; }
			set { name = value; }
		}

		public CellDefinition(Dictionary<string, Attribut> attribut, string zellTyp)
		{
			this.Attributes = attribut;
			this.name = zellTyp;
		}

		public CellDefinition(string zellTyp)
		{
			this.name = zellTyp;
		}

		public void addAttribut(Attribut attr)
		{
			attributes.Add(attr.Name, attr);
		}

		public override string ToString()
		{
			//string returnstring = "Zelle: Zelltyp=" + zellTyp + "[";
			//foreach (Attribut tmpAttribut in attribute)
			//{
			//	returnstring += "[" + tmpAttribut + "], ";
			//}

			//int lastInd = returnstring.LastIndexOf(",");
			//returnstring = returnstring.Substring(0, lastInd) + "]";
			return this.name;
		}

		public override bool Equals(object obj)
		{
			if (!(obj is CellDefinition))
			{
				return false;
			}
			CellDefinition tmp = (CellDefinition)obj;
			return tmp.name == name;
		}

		public override int GetHashCode()
		{
			return name.GetHashCode();
		}
	}
}
